#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM registry.cn-hangzhou.aliyuncs.com/newbe36524/aspnet:5.0-alpine AS base
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:5000
ENV ASPNETCORE_ENVIRONMENT Development
EXPOSE 5000

FROM registry.cn-hangzhou.aliyuncs.com/newbe36524/sdk:5.0-alpine AS build
WORKDIR /src
COPY IdentityService/IdentityService.csproj IdentityService/
COPY EasyDapr.Infrastructure.App/EasyDapr.Infrastructure.App.csproj EasyDapr.Infrastructure.App/
COPY EasyDapr.Infrastructure/EasyDapr.Infrastructure.csproj EasyDapr.Infrastructure/
COPY EasyDapr.Domain/EasyDapr.Domain.csproj EasyDapr.Domain/
COPY EasyDapr.Infrastructure.EfCore/EasyDapr.Infrastructure.EfCore.csproj EasyDapr.Infrastructure.EfCore/
COPY EasyDapr.Infrastructure.OTel/EasyDapr.Infrastructure.OTel.csproj EasyDapr.Infrastructure.OTel/
RUN dotnet restore "IdentityService/IdentityService.csproj"
COPY . .
WORKDIR "/src/IdentityService"
RUN dotnet build "IdentityService.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "IdentityService.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "IdentityService.dll"]
